feat: add failure analyzer for systematic PR failure tracking#26
Merged
Conversation
Implements issue #25 - FailureAnalyzer class that records and analyzes PR failures to help prevent repeated mistakes. Key features: - Records failures to logs/failures.jsonl with structured metadata - Categorizes failures (missing_tests, ci_failures, scope_creep, etc.) - Provides similar failure matching for Engineer awareness - Generates failure pattern analysis for Auditor health reports - Configurable backoff policy to avoid reworking failing issues - 90-day retention with automatic rotation Integration: - Tech Lead: Records failures when closing PRs with reasoning - Engineer: Gets warnings about similar past failures before starting - Auditor: Includes failure patterns in health reports and insights Configuration (repositories.json): ```json { "settings": { "failure_analyzer": { "enabled": true, "retention_days": 90, "backoff_policy": { "skip_runs_after_failures": 1, "consecutive_failures_threshold": 2 } } } } ``` Closes #25 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements issue #25 - FailureAnalyzer class that systematically records and analyzes PR failures to help prevent repeated mistakes. This addresses the development focus on agent reliability and error recovery.
Key capabilities:
logs/failures.jsonlwith structured metadata (issue ID, category, root cause, evidence)Evidence
Dependencies
Changes
New Files
src/barbossa/utils/failure_analyzer.py(663 lines) - Core FailureAnalyzer class with:record_failure()- Record failures with structured metadataget_similar_failures()- Find matching past failures by keywords/labelsget_failure_warnings()- Formatted warnings for Engineer promptsshould_skip_issue()- Backoff policy check for repeatedly failing issuesanalyze_failure_patterns()- Pattern analysis for Auditor reportsrotate_failures()- 90-day retention cleanuptests/test_failure_analyzer.py(542 lines) - Comprehensive test suite with 23 testsModified Files
src/barbossa/agents/tech_lead.py- Records failures when closing PRssrc/barbossa/agents/engineer.py- Queries failure history before starting issuessrc/barbossa/agents/auditor.py- Includes failure patterns in health reportsprompts/engineer.txt- Added{{failure_warnings_section}}placeholderconfig/repositories.schema.json- Addedfailure_analyzersettings schemaTesting
PYTHONPATH=src python -m unittest tests.test_failure_analyzer -vConfiguration Example
{ "settings": { "failure_analyzer": { "enabled": true, "retention_days": 90, "backoff_policy": { "skip_runs_after_failures": 1, "consecutive_failures_threshold": 2 } } } }🤖 Generated with Claude Code